<?php
include( "inc/header.php" );
login_check( );
if ( $_GET['Action'] == "Save" )
{
				if (empty($_POST['id']) || !isset($_POST['id'])) {
					$db->query("INSERT INTO tun2_email_set (id,host,port,trueemail,username,password,debug,addresser) VALUES \r\n\t\t(1,'".$_POST['host']."','{$_POST['port']}','{$_POST['trueemail']}','{$_POST['username']}','{$_POST['password']}','{$_POST['debug']}','{$_POST['addresser']}')");
				} else {
					delindexhtml( $_POST['id'], $_POST['webhtmlmode'] );
					$db->query( "UPDATE tun2_email_set SET \r\n\thost='".$_POST['host']."',\r\n\tport='{$_POST['port']}',\r\n\ttrueemail='{$_POST['trueemail']}',\r\n\tusername='{$_POST['username']}',\r\n\tpassword='{$_POST['password']}',\r\n\tdebug='{$_POST['debug']}',\r\n\taddresser='{$_POST['addresser']}' WHERE id={$_POST['id']} " );
				}
				addlog( "修改邮箱配置", $_SESSION['user_name'] );
				admin_showerr( "<li>邮箱配置信息修改成功</li>", "Admin_Email_Set.php", 1 );
}
else
{
				if ($_SESSION['acl'] != 1) admin_showerrs( "<li>你无权设置邮箱信息</li>", null, 0 ); //@author by chenhao 2010-01-19 禁止普通管理员操作该项
				$db->query( "select * from tun2_email_set" );
				$db->next_record( );
				echo "<script language=\"javascript\" src=\"inc/js.js\"></script>\r\n<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\"><tr><td>您的邮箱必需支持SMTP功能，服务器端必须开启SOCKET模块，否则无法发送！如果你在设置中有什么问题或困难请与<a href='http://www.22cn.cn/' target=\"_blank\">呜雷科技</a>联系</td></tr></table><br/><table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\">\r\n<form action=\"Admin_Email_Set.php?Action=Save\" method=\"post\" onSubmit=\"return Validator.Validate(this,3)\">\r\n  <tr>\r\n   <td width=\"20%\" align=\"right\">SMTP主机名：</td>\r\n   <td>\r\n     <input name=\"id\" type=\"hidden\" value=\"";
				echo $db->Record['id'];
				echo "\" />\r\n     <input name=\"host\" type=\"text\" value=\"";
				echo $db->Record['host'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填SMTP主机名\"/>如：smtp.126.com\r\n</td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">端口：</td>\r\n    <td><input name=\"port\" type=\"text\" value=\"";
				echo $db->Record['port'];
				echo "\" size=\"6\" dataType=\"Require\" msg=\"请填主机端口\"/> 一般为25</td>\r\n  </tr>  \r\n  <tr>\r\n    <td align=\"right\">真实的地址：</td>\r\n    <td><input name=\"trueemail\" type=\"text\" value=\"";
				echo $db->Record['trueemail'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填真实的邮箱地址\"/>如：xxx@126.com</td>\r\n  </tr>\r\n  \r\n  <tr>\r\n    <td align=\"right\">账号：</td>\r\n    <td><input name=\"username\" type=\"text\" value=\"";
				echo $db->Record['username'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填账号\"/></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">密码：</td>\r\n    <td><input name=\"password\" type=\"password\" value=\"";
				echo $db->Record['password'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填密码\"/></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">显示和服务器会话信息：</td>\r\n    <td><select name=\"debug\">";
				if ($db->Record['debug']=="truee")
				{
                echo "<option value=\"truee\" >是</option> <option value=\"false\" >否</option>";
				}else{
				echo "<option value=\"false\" >否</option>	<option value=\"truee\" >是</option>";
				}
				echo "</select></td>\r\n  </tr>\r\n  <tr>\r\n    <td align=\"right\">显示给用户的发件人：</td>\r\n    <td><input name=\"addresser\" type=\"text\" value=\"";
				echo $db->Record['addresser'];
				echo "\" size=\"30\" dataType=\"Require\" msg=\"请填发件人\"/></td>\r\n  </tr>\r\n  <tr>\r\n    <td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"button\" id=\"button\" value=\"更新邮箱设置\" /></td>\r\n  </tr>\r\n  </form>\r\n</table>\r\n";
}
echo "</body>\r\n</html>";
?>
